package com.jiguang.fuwutest;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {

    /**
     * 开始服务
     */
    private Button mBtnstart;
    /**
     * 停止服务
     */
    private Button mBtnstop;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        //创建启动servicede的Intent,以及Intent属性
//        final Intent intent = new Intent();
//        intent.setAction("com.jiguang.fuwutest.TEST_SERVICE1");
        final Intent intent = new Intent(this,TestService1.class);
        mBtnstart.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startService(intent);
            }
        });
        mBtnstop.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                stopService(intent);
            }
        });
    }

    private void initView() {
        mBtnstart = (Button) findViewById(R.id.btnstart);
        mBtnstop = (Button) findViewById(R.id.btnstop);
    }


}
